package cn.wongshu.student.handel;

import cn.wongshu.student.pojo.Result;
import cn.wongshu.student.pojo.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionHandler {

    @org.springframework.web.bind.annotation.ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result handleException(Exception e){
            e.printStackTrace();
            return new Result(false, StatusCode.ERROR,e.getMessage());
        }

}
